<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link rel="stylesheet" type="text/css" href="../css/app.css">
    <link rel="stylesheet" type="text/css" href="../css/orderGrad.css">
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="/h5/js/all.js"></script>
    <link rel="stylesheet" type="text/css" href="/h5/css/all.css">
    <script type="text/javascript" src="../js/alertMsg.js"></script>
</head>
<body>
    <div class="shippingNewEvaluation shippingOrderEvaluate">
        <div class="orderParamTitle">
            新增评价
            <img src="../images/return.png" class="orderRtns" onclick="history.go(-1)">
        </div>
        <div style="height:1.066667rem"></div>
        <div class="shippingEvaluationGrade">
            <p>评价等级：</p>
            <div class="shippingGradeChose">
                <input type="radio" name="radio1" value="0"><label for="radio11">很差</label>
                <input type="radio" name="radio1" value="1"><label for="radio12">差</label>
                <input type="radio" name="radio1" value="2"><label for="radio12">一般</label>
                <input type="radio" name="radio1" value="3"><label for="radio11">良好</label>
                <input type="radio" name="radio1" value="4"><label for="radio12">很好</label>
            </div>
        </div>
        <div class="content5">
            <div><p>订单评价内容</p></div>
            <textarea id="content" name="content" placeholder="请输入您遇到的问题（10-200字）"></textarea>
        </div>
        <div class="button">
            <div onclick="commentOrder();">立即评价</div>
        </div>
    </div>
    <script>
       
    </script>
</body>
</html>
<script type="text/javascript" src="../js/getPageId.js"></script>
<script>
    var id = localStorage.getItem('orderShowId');
    var userInfo = JSON.parse(localStorage.getItem('userInfo'));
    var app_access = userInfo.app_access;
    var token = userInfo.token;
    function commentOrder() {
        if(!$('input[name="radio1"]:checked').val()){
            MC.msg.alert("请选择评价等级");
            return;
        }
        var content = $("#content").val(),
            selectOption = $('input[name="radio1"]:checked').val();
        var data = {
            out_trade_no: MC.get('out_trade_no'),
            app_access: app_access,
            token: token,
            content: content,
            level:selectOption
        }
        $.ajax({
            url: '/api/order/my/comment',
            data: data,
            type: 'post',
            dataType: 'json',
            success: function(data) {
                if(data.code == 200){
                    alertMsg(data.msg)
                  //  window.location.href='orderDocking.html'
                    window.open('/h5/order/kongzhitai.html?out_trade_no='+MC.get('out_trade_no'),'_self');
                }else{
                    alertMsg(data.msg)
                    $("#content").val('')
                }
            },
            err: function(err) {
                alertMsg(err)
            }
        })
    }
</script>
